package com.sztz.mapstruct.N子类转换;

import org.mapstruct.Mapper;
import org.mapstruct.SubclassMapping;
import org.mapstruct.factory.Mappers;

/**
 * CarMapper
 *
 * @author yyf
 * @email yeyafei@hotmail.com
 */
@Mapper
public interface AnimalMapper {

    AnimalMapper INSTANCE = Mappers.getMapper(AnimalMapper.class);

    /**
     * 子类映射转换
     *
     * @param animal
     * @return AnimalDTO
     */
    @SubclassMapping(source = Dog.class, target = DogDTO.class)
    @SubclassMapping(source = Cat.class, target = CatDTO.class)
    AnimalDTO toDto(Animal animal);
}
